/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bonc.common.security.controller;

import com.bonc.common.bean.PageContent;
import com.bonc.common.bean.ResultMessage;
import com.bonc.common.security.entity.UiResource;
import com.bonc.common.security.entity.*;

import com.bonc.common.security.service.*;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * UiResource的RestController
 * @author 自动生成的代码
 */
@RestController
@RequestMapping(value = "/api/uiResource2")
public class UiResourceRestController2 {
    
        
     @Autowired
    private UiResourceService2 uiResourceService;


    

    /**
     * @return the uiResourceService
     */
    public UiResourceService2 getUiResourceService() {
        return uiResourceService;
    }

    /**
     * @param uiResourceService the uiResourceService to set
     */
    public void setUiResourceService(UiResourceService2 uiResourceService) {
        this.uiResourceService = uiResourceService;
    }

   
    /**
     * 提取有权限的控件资源
     *
     * @param id
     * @return
     */
    @RequestMapping( method = RequestMethod.GET)
    public List<UiResource> get(String loginId) {

        List<UiResource> list = getUiResourceService().getAccessedUiResource(loginId);

        return list;

    }
    
    

   
    
   
    /**
     *  注册日期类数据绑定，自动进行yyyy-MM-dd格式的字符串转换成java.util.Date
     * @param binder 
     */
    @InitBinder
    protected void initBinder(WebDataBinder binder) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        dateFormat.setLenient(false);
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));//true表示允许为空
    }

    
    
}
